<?php
/*
 * Created on 2014-2-28
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 session_start();
 ini_set('display_errors','0');
 header('Content-Type:text/html;charset=utf-8');
 
 $return=array('state'=>1,'data'=>$re,'reason'=>'');
 
// if (empty($_SESSION["nns_role_pris"])==0 || empty($_SESSION["nns_mgr_id"])){
// 	$return['reason']='没有权限';
// 	echo json_encode($return);
// }
 
// if ($_POST['time']){
// 	$guest_time=(int)$_POST['time'];
// 	//5秒接口失效
// 	if (time()-$guest_time>5){
// 		$return['reason']='没有时效性';
// 		echo json_encode($return);
// 	}
// }
 
 $action=$_REQUEST['action'];
 if (!empty($action)){
 	if (!file_exists($action.'.func.php')){
 		exit;
 	};
 }
 
 include_once dirname(dirname(dirname(__FILE__))).'/nn_logic/nl_common.func.php';
 include_once dirname(dirname(dirname(__FILE__))).'/op/op_queue.const.php';
 include_once $action.'.func.php';
 
 $db=nl_get_db(NL_DB_WRITE);
 $db->open();
 $params=array();
 //$json = '{"begin":"2014-10-23 00:00:00","end":"2014-10-24 00:00:00","sp":"jllt","time":"1414073589","action":"st_task_import_state","CKFinder_Path":"Log:\/interface\/businss\/error\/20140605\/:1","e9407_defaultcid":"2","e9407_comment":"1400230211","Hm_lvt_f5127c6793d40d199f68042b8a63e725":"1413442914,1413516131,1413858878,1413943985","PHPSESSID":"nt9f908b7hduhfecu7vldjq425","Hm_lpvt_f5127c6793d40d199f68042b8a63e725":"1414072037"}';
 $params=$_REQUEST;//json_decode($json,true);
 //print_r($params);die;
 $re=$action($db,$params);
 //查注入epg总数
 $num = null;
 if($action == 'st_task_import_state')
 {
     $num = st_task_num($db,$params);
 }
 //echo '<pre>';print_r($num);die;
 $db->close();
 $db=NULL; 
 
 $return=array('num'=>$num,'state'=>0,'data'=>$re,'reason'=>'OK');
 
 
 echo json_encode($return);
 
?>
